<script setup>
import { ref } from "vue";

const currentTime = ref(new Date().toLocaleString("zh-CN"));
</script>

<template>
  <div class="home-container">
    <el-card class="welcome-card">
      <template #header>
        <div class="card-header">
          <span>欢迎使用轻客管家管理系统</span>
        </div>
      </template>
      <div class="welcome-content">
        <el-row :gutter="20">
          <el-col :span="8">
            <el-card class="stat-card">
              <div class="stat-item">
                <el-icon class="stat-icon"><User /></el-icon>
                <div class="stat-info">
                  <div class="stat-number">1,234</div>
                  <div class="stat-label">总客户数</div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card class="stat-card">
              <div class="stat-item">
                <el-icon class="stat-icon"><Connection /></el-icon>
                <div class="stat-info">
                  <div class="stat-number">567</div>
                  <div class="stat-label">线索数量</div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card class="stat-card">
              <div class="stat-item">
                <el-icon class="stat-icon"><Opportunity /></el-icon>
                <div class="stat-info">
                  <div class="stat-number">89</div>
                  <div class="stat-label">商机数量</div>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>

        <div class="current-time">
          <el-icon><Clock /></el-icon>
          <span>当前时间：{{ currentTime }}</span>
        </div>
      </div>
    </el-card>
  </div>
</template>

<style scoped>
.home-container {
  padding: 20px;
}

.welcome-card {
  margin-bottom: 20px;
}

.card-header {
  font-size: 18px;
  font-weight: bold;
  color: #1890ff;
}

.welcome-content {
  padding: 20px 0;
}

.stat-card {
  text-align: center;
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.stat-icon {
  font-size: 40px;
  color: #1890ff;
}

.stat-info {
  text-align: left;
}

.stat-number {
  font-size: 24px;
  font-weight: bold;
  color: #1890ff;
}

.stat-label {
  font-size: 14px;
  color: #666;
  margin-top: 5px;
}

.current-time {
  margin-top: 30px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.current-time .el-icon {
  margin-right: 5px;
}
</style>
